<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<%@page import="avicit.platform6.core.locale.PlatformLocalesJSTL"%>
<%@page import="java.util.Locale"%>
<%@page import="avicit.platform6.api.session.SessionHelper"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="avicit.platform6.commons.utils.ViewUtil"%>
<%@ taglib prefix="sec"
	uri="/WEB-INF/tags/shiro.tld"%>
	<%@page import="avicit.platform6.api.sysshirolog.impl.AfterLoginSessionProcess"%>
<% 
Object lang=session.getAttribute(AfterLoginSessionProcess.SESSION_CURRENT_LANGUAGE_CODE);
String languageCode="zh_CN";
if(lang!=null){
	languageCode=lang.toString();
}
	Locale locale =SessionHelper.getLocaleByUser(request);
%>
	
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>代码维护</title>
<base href="<%=ViewUtil.getRequestPath(request)%>">

<jsp:include
	page="/avicit/platform6/component/common/EasyUIJsInclude.jsp"></jsp:include>
<script type="text/javascript"
	src="avicit/cbb/techclass/tabledefine/commtablemanager/table_col_code.js"></script>
<jsp:include page="/avicit/im/common/ImUIJSCSSInclude.jsp"></jsp:include>
<script type="text/javascript"
	src="avicit/cbb/techclass/tabledefine/commtablemanager/locale/language_<%=languageCode%>.js"></script>
<link href="static/css/custom/lantop/css/custom.css" type="text/css"  rel="stylesheet">
<%
	String sysId = request.getParameter("sysId");
	String tableName = request.getParameter("tableName");
	String nodeTypeNew = request.getParameter("nodeType");
	String nodeId = request.getParameter("nodeId");
	String nodeName = request.getParameter("nodeName");
%>
<script type="text/javascript">
var baseurl = "<%=ViewUtil.getRequestPath(request)%>";
	//此事件必须放在jsp中,不能提取到js中,否则不能加载数据
	$(function() {
		sysId = "<%=sysId%>";
		tableName = "<%=tableName%>";
		nodeTypeNew = "<%=nodeTypeNew%>";
		nodeId = "<%=nodeId%>";
		nodeName = "<%=nodeName%>";
		if ("" == tableName || "null" == tableName) {
			tableName = "CBB_CS_WJ";
		}
		if ("" == nodeTypeNew || "null" == nodeTypeNew) {
			nodeTypeNew = "Y";
		}
		document.getElementById("selectCol").style.display = 'none';
		if (nodeTypeNew == "N") {
			$('#add').linkbutton('disable');
			$('#selectCode').linkbutton('disable');
			$('#removeit').linkbutton('disable');
			$('#MoveUp').linkbutton('disable');
			$('#MoveDown').linkbutton('disable');
			$('#save').linkbutton('disable');
			$('#inputCode').linkbutton('disable');
		}
		if ("" == sysId || "null" == sysId) {
			sysId = "CBB";
		}
		if ("" == nodeId || "null" == nodeId) {
			nodeId = "-1";
		}
		if ("" == nodeName || "null" == nodeName) {
			nodeName = "测试";
		}
		$('#cbbTabColumnsTypeDataGrid')
				.datagrid(
						{
							url : 'platform/aos/commtablemanagerController/getCbbTabColumnsData.json?sysId='
									+ sysId
									+ '&tableName='
									+ tableName
									+ '&isTemplet=' + isTemplet,
							onLoadSuccess : setInitFirstData
						});
	});
	// SanXiaFiles Create By Tangkun start
	function getResultByInput(){
		$('#cbbTabColumnsTypeDataGrid').datagrid({
			url : 'platform/aos/commtablemanagerController/getCbbTabColumnsData.json?sysId=' + sysId + '&tableName=' + tableName + '&isTemplet=' + isTemplet
					+ '&colLabel=colLabel&inputWord=' + encodeURI(encodeURI($('#query').val()))
		});
	}
	function keyDownQuery(){
		if(event.keyCode==13){
			getResultByInput();
		}
	}
	// SanXiaFiles Create By Tangkun End
</script>
<style type="text/css">
.textbox {
	border: solid 1px #a5acb5;
}

.input,img {
	vertical-align: middle;
}

<!--
实现input和img水平对齐 -->.labelbg {
	background:
		url('../../js/jQuery/jquery-easyui-1.3.5/themes/icons/required.gif')
		right 0 no-repeat;
}
.icon-im-newndisallfield{
   margin-top:0px !important;
}
</style>
</head>
<body id="myBody" class="easyui-layout">
	<div data-options="region:'west'" id="westDiv"
		style="width: 500px; height: 0; overflow: hidden; font-size: 0;border-right:1px solid #dedede;">
		<div id="tb1"  style="padding: 10px 5px;">
			<sec:accesscontrollist hasPermission="3"
				domainObject="commtablemanager_table_col_code_button_selectAllCol">
				<%-- 显示全部字段 --%>

				<a class="easyui-linkbutton selbtnc" iconCls="icon-im-newndisallfield" style="margin-left: 20px;"
					onclick="selectAllCol();" href="javascript:void(0);"
					id="selectAllCol"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.codeMaintain.table.button.showAllField","i18n.lantop",locale)%></a>
				<%-- 显示基本字段 --%>
				<a style="padding:0px  2px;border:1px solid #dedede;height:27px;line-height:27px;"  class="easyui-linkbutton" plain="true" iconCls="icon-im-newnhideallfield"
					onclick="selectAllCol();" href="javascript:void(0);" id="selectCol"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.codeMaintain.table.button.showAllField.showBasicField","i18n.lantop",locale)%></a>
			</sec:accesscontrollist>
			<div
				style="background: white; width: 150px; height: 25px; border-radius: 3px; border: 1px solid #ccc; float: right;">
				<input placeholder="快速检索" type="text" id="query" onblur="getResultByInput()" onkeydown="keyDownQuery();"
					style="float: left; box-sizing: border-box; padding-left: 5px; width: 123px; height: 25px; outline: none; border: none;" />
				<img src="avicit/im/lantop/common/search/image/icon_tool14.png"
					style="float: right; margin-top: 2px; margin-right: 2px;cursor: pointer;">
			</div>
			<!-- 
				 SanXiaFiles Create By Tangkun End  
				-->
			</div>
		<table id="cbbTabColumnsTypeDataGrid" style="border-right:1px solid #dedede;" data-options="
											rownumbers: false,
											animate: true,
											collapsible: false,
											fitColumns: true,
											autoRowHeight: false,
											scrollbarSize:0,
											singleSelect: true,
											pagination:true,
											pageSize:100, 
											pageList:[100,150,200], 
								    		striped:true,
											fit:true,
											method: 'post',
											onClickRow:onClickRowType,
											toolbar: '#tb1'
										">
			<thead>
				<tr>
					<sec:accesscontrollist hasPermission="3"
						domainObject="commtablemanager_table_col_code_datagrid_id">
						<th data-options="field:'id', halign:'center',hidden:true"
							title="主键ID" width="20">主键ID</th>
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3"
						domainObject="commtablemanager_table_col_code_datagrid_colOrder">
						<%-- 顺序 --%>
						<th
							data-options="field:'colOrder', halign:'center', align:'center',formatter:fomaterColOrder"
							width="50" title="顺序"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.codeMaintain.table.order","i18n.lantop",locale)%></th>
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3"
						domainObject="commtablemanager_table_col_code_datagrid_colLabel">
						<%-- 字段中文名 --%>
						<th
							data-options="field:'colLabel',halign:'center', align:'center',formatter:fomaterColLabel"
							width="100" title="字段中文名"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.codeMaintain.table.fieldCHNName","i18n.lantop",locale)%></th>
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3"
						domainObject="commtablemanager_table_col_code_datagrid_colName">
						<th
							data-options="field:'colName',halign:'center', align:'center', hidden: true"
							width="100" title="字段名">字段名</th>
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3"
						domainObject="commtablemanager_table_col_code_datagrid_colDropdownType">
						<%-- 类型 --%>
						<th
							data-options="field:'colDropdownType', halign:'center', align:'center', editor:{type:'combobox',options:{'validType':'length[0,50]',required:true,panelHeight: 'auto',valueField:'lookupCode',textField:'lookupName',data:[{lookupCode:'0',lookupName:'无'},{lookupCode:'1',lookupName:'参选'},{lookupCode:'2',lookupName:'只选'},{lookupCode:'3',lookupName:'选择'},{lookupCode:'4',lookupName:'多选'}],editable:false,onSelect:onSelectCom}},formatter:fomaterType"
							width="100" title="类型"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.codeMaintain.table.type","i18n.lantop",locale)%></th>
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3"
						domainObject="commtablemanager_table_node_record_datagrid_colRuleName">
						<th
							data-options="field:'colRuleName',halign:'center', align:'center', editor:{type:'text'},hidden:true"
							width="100" title="生成规则英文">生成规则英文</th>
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3"
						domainObject="commtablemanager_table_node_record_datagrid_colRuleTitle">
						<%-- 生成规则 --%>
						<th
							data-options="field:'colRuleTitle',halign:'center', align:'center',editor:{type:'text'},formatter:fomaterColRuleTitle"
							width="100" title="生成规则"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.codeMaintain.table.createRule","i18n.lantop",locale)%></th>
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3"
						domainObject="commtablemanager_table_node_record_datagrid_customPath">
						<th
							data-options="field:'customPath',halign:'center', align:'center', editor:{type:'text'},hidden:true"
							width="100" title="路径">路径</th>
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3"
						domainObject="commtablemanager_table_structure_datagrid_colIsDisplay">
						<th data-options="field:'colIsDisplay',hidden: true" width="100"
							title="是否可见">是否可见</th>
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3"
						domainObject="commtablemanager_table_structure_datagrid_colIsSys">
						<th data-options="field:'colIsSys',hidden: true" width="100"
							title="系统字段">系统字段</th>
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3"
						domainObject="commtablemanager_table_structure_datagrid_colGeneMethod">
						<th
							data-options="field:'colGeneMethod', hidden: true, halign:'center', align:'center', editor:{type:'combobox',options:{required:true,panelHeight: 'auto',valueField:'lookupCode',textField:'lookupName',data:[{lookupCode:0,lookupName:'空'},{lookupCode:1,lookupName:'默认值'},{lookupCode:2,lookupName:'序列'},{lookupCode:3,lookupName:'顺带'},{lookupCode:4,lookupName:'组合项'},{lookupCode:5,lookupName:'统计生成'}],editable:false}},formatter:fomaterColGeneMethod"
							width="100" title="生成方式">生成方式</th>
					</sec:accesscontrollist>
				</tr>
			</thead>
		</table>
	</div>
	<div data-options="region:'center'"
		style="height: 0; overflow: hidden; font-size: 0;">
		<div id="tb"  style="padding:10px 0px;">
			<sec:accesscontrollist hasPermission="3"
				domainObject="commtablemanager_table_col_code_button_append">
				<%-- 添加 --%>
				<a class="easyui-linkbutton selbtnc" iconCls="icon-im-add"  style="margin-left:20px;"
					onclick="append();" href="javascript:void(0);" id="add"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.codeMaintain.table2.button.add","i18n.lantop",locale)%></a>
			</sec:accesscontrollist>
			<sec:accesscontrollist hasPermission="3"
				domainObject="commtablemanager_table_col_code_button_selectCode">
				<%-- 引用 --%>
				<a class="easyui-linkbutton selbtnc"
					iconCls="icon-im-newinsert" onclick="selectCode();"
					href="javascript:void(0);" id="selectCode"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.codeMaintain.table2.button.quote","i18n.lantop",locale)%></a>
			</sec:accesscontrollist>
			<sec:accesscontrollist hasPermission="3"
				domainObject="commtablemanager_table_col_code_button_removeit">
				<%-- 删除 --%>
				<a class="easyui-linkbutton selbtnc" iconCls="icon-im-remove"
					onclick="removeit();" href="javascript:void(0);" id="removeit"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.codeMaintain.table2.button.delete","i18n.lantop",locale)%></a>
			</sec:accesscontrollist>
			<sec:accesscontrollist hasPermission="3"
				domainObject="commtablemanager_table_col_code_button_MoveUp">
				<%-- 上移 --%>
				<a class="easyui-linkbutton selbtnc" iconCls="icon-im-newup"
					onclick="MoveUp();" href="javascript:void(0);" id="MoveUp"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.codeMaintain.table2.button.moveUp","i18n.lantop",locale)%></a>
			</sec:accesscontrollist>
			<sec:accesscontrollist hasPermission="3"
				domainObject="commtablemanager_table_col_code_button_MoveDown">
				<%-- 下移 --%>
				<a class="easyui-linkbutton selbtnc" iconCls="icon-im-newdown"
					onclick="MoveDown();" href="javascript:void(0);" id="MoveDown"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.codeMaintain.table2.button.moveDown","i18n.lantop",locale)%></a>
			</sec:accesscontrollist>
			<sec:accesscontrollist hasPermission="3"
				domainObject="commtablemanager_table_col_code_button_save">
				<%-- 保存 --%>
				<a class="easyui-linkbutton selbtnc" iconCls="icon-im-save" onclick="accept();" href="javascript:void(0);" id="save"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.codeMaintain.table2.button.save","i18n.lantop",locale)%></a>
			</sec:accesscontrollist>
			
		</div>
		<table id="cbbTabColumnsCodeDataGrid" class="easyui-datagrid"
			data-options="
											rownumbers: true,
											animate: true,
											collapsible: false,
											fitColumns: true,
											autoRowHeight: false,
											singleSelect: true,
											pagination:true,
											pageSize:100, 
											pageList:[100,150,200], 
								    		striped:true,
								    		scrollbarSize:0,
											fit:true,
											method: 'post',
											onClickRow:onClickRowCode,
											selectOnCheck:false,
											toolbar: '#tb'
										">
			<thead>
				<tr>
					<sec:accesscontrollist hasPermission="3"
						domainObject="commtablemanager_table_col_code_datagrid_ID">
						<th data-options="field:'ID', halign:'center',checkbox:true"
							title="主键ID" width="20">主键ID</th>
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3"
						domainObject="commtablemanager_table_col_code_datagrid_CODE_ORDER">
						<%-- 顺序 --%>
						<th
							data-options="field:'CODE_ORDER', halign:'center',align:'center', editor:{type:'numberbox',options:{required:true,'validType':'length[0,10]'}}"
							width="100" title="顺序"><img
							src="avicit/im/common/im_themes_extend/required.gif" alt="必填">
							<%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.codeMaintain.table2.order","i18n.lantop",locale)%></th>
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3"
						domainObject="commtablemanager_table_col_code_datagrid_COLUMN_ID">
						<th
							data-options="field:'COLUMN_ID', halign:'center',hidden:true,editor:{type:'text'}"
							title="列ID" width="20">列ID</th>
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3"
						domainObject="commtablemanager_table_col_code_datagrid_LOOKUP_NAME">
						<%-- 显示值 --%>
						<th
							data-options="field:'LOOKUP_NAME',halign:'center', align:'center', editor:{type:'validatebox',options:{required:true,'validType':'length[0,100]'}}"
							width="100" title="显示值"><img
							src="avicit/im/common/im_themes_extend/required.gif" alt="必填">
							<%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.codeMaintain.table2.showValue","i18n.lantop",locale)%></th>
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3"
						domainObject="commtablemanager_table_col_code_datagrid_LOOKUP_CODE">
						<%-- 真实值 --%>
						<th
							data-options="field:'LOOKUP_CODE',halign:'center', align:'center', editor:{type:'validatebox',options:{required:true,'validType':'length[0,100]'}}"
							width="100" title="真实值"><img
							src="avicit/im/common/im_themes_extend/required.gif" alt="必填">
							<%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.codeMaintain.table2.trueValue","i18n.lantop",locale)%></th>
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3"
						domainObject="commtablemanager_table_col_code_datagrid_CODE_IS_VALID">
						<%-- 是否有效 --%>
						<th
							data-options="field:'CODE_IS_VALID',halign:'center', align:'center', editor:{type:'combobox',options:{'validType':'length[0,4]',required:true,panelHeight: 'auto',valueField:'lookupCode',textField:'lookupName',data:[{lookupCode:'Y',lookupName:'有效'},{lookupCode:'N',lookupName:'无效'}],editable:false}},formatter:fomaterYn"
							width="100" title="是否有效"><img
							src="avicit/im/common/im_themes_extend/required.gif" alt="必填"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.codeMaintain.table2.isEffective","i18n.lantop",locale)%></th>
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3"
						domainObject="commtablemanager_table_col_code_datagrid_CTYPE">
						<%-- 类型 --%>
						<th
							data-options="field:'CTYPE',halign:'center', align:'center',formatter:fomaterCtype"
							width="100" title="类型"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.codeMaintain.table2.type","i18n.lantop",locale)%></th>
					</sec:accesscontrollist>
				</tr>
			</thead>
		</table>
	</div>
</body>
<script type="text/javascript" src="static/js/platform/index/js/divscroll.js" ></script>
<script>
	$(function(){
		$(".datagrid-view2").find(".datagrid-body").perfectScrollbar();
	});
</script>
</html>
